package org.jgs1904.oopbase.method;

/**
 * @author: 默苍璃
 * @date: 2022-09-13 11:06
 */
public class Person {
    private String name;
    private int age;

    public String getName() {
        return this.name;
    }

    public void setName(String name) {
//        if (name == null || name.isBlank()) {
//            throw new IllegalArgumentException("invalid name");
//        }
//        this.name = name.strip(); // 去掉首尾空格
        this.name = name;
    }

    public int getAge() {
        return this.age;
    }

    public void setAge(int age) {
        if (age < 0 || age > 100) {
            throw new IllegalArgumentException("invalid age value");
        }
        this.age = age;
    }
}
